package cn.bone.base.boot.demo1.web;

import cn.bone.base.boot.demo1.bean.Greeting;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.concurrent.atomic.AtomicInteger;

/**
 * Created by MD-01 on 2016/9/1.
 */
@RestController
public class GreetingController {

    private final AtomicInteger counter = new AtomicInteger();

    @RequestMapping("/greeting")
    public Greeting greeting(@RequestParam(value="name",required = false,defaultValue = "world")String name){
        return new Greeting(counter.incrementAndGet(),"hello "+name);
    }
}
